﻿<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
             x:Class="UT3Bots.Visualizer.App"
			 xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
			 xmlns:cvt="clr-namespace:UT3Bots.Visualizer.Converters"
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 mc:Ignorable="d"
             xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" xmlns:System_Windows_Controls_Primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
             >
    <Application.Resources>
		<cvt:LocationXConverter  x:Key="XC" />
		<cvt:LocationYConverter  x:Key="YC" />
		<cvt:VisibilityConverter x:Key="VC" />
		<cvt:BotColorConverter x:Key="BC" />
		
		<Style x:Key="UT3ListBoxStyle" TargetType="ListBox"/>

		<Style x:Key="UT3ListBoxItemStyle" TargetType="ListBoxItem">
			<Setter Property="Background" Value="#FF606060"/>
		</Style>
		<Style x:Key="UT3ThumbStyle" TargetType="Thumb">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Thumb">
						<Grid>
							<Grid.Resources>
								<SolidColorBrush x:Key="Background" Color="#FF003255"/>
								<Color x:Key="ThumbOuterBorderFillColor1">#FF969696</Color>
								<Color x:Key="ThumbOuterBorderFillColor2">#FF969696</Color>
								<Color x:Key="ThumbOuterBorderFillColor3">#FF969696</Color>
								<Color x:Key="ThumbOuterBorderFillColor4">#FF969696</Color>
								<SolidColorBrush x:Key="ThumbInnerRoundBorderBrush" Color="#FFFFFFFF"/>
								<SolidColorBrush x:Key="ThumbOuterRoundBorderBrush" Color="#00FFFFFF"/>
								<Color x:Key="ThumbInnerBorderFillColor1">#00FFFFFF</Color>
								<Color x:Key="ThumbInnerBorderFillColor2">#00FFFFFF</Color>
								<Color x:Key="MouseOverThumbOuterBorderFillColor1">#FFEAF0F0</Color>
								<Color x:Key="MouseOverThumbOuterBorderFillColor2">#FFDCE5EC</Color>
								<Color x:Key="MouseOverThumbOuterBorderFillColor3">#FFD5DDE6</Color>
								<Color x:Key="MouseOverThumbOuterBorderFillColor4">#FF798893</Color>
								<Color x:Key="MouseOverThumbInnerBorderFillColor1">#CDFFFFFF</Color>
								<Color x:Key="MouseOverThumbInnerBorderFillColor2">#45FFFFFF</Color>
								<Color x:Key="PressedThumbOuterBorderFillColor1">#FFEAF0F0</Color>
								<Color x:Key="PressedThumbOuterBorderFillColor2">#FFDCE5EC</Color>
								<Color x:Key="PressedThumbOuterBorderFillColor3">#FFD5DDE6</Color>
								<Color x:Key="PressedThumbOuterBorderFillColor4">#FF798893</Color>
								<Color x:Key="PressedThumbInnerBorderFillColor1">#CDFFFFFF</Color>
								<Color x:Key="PressedThumbInnerBorderFillColor2">#45FFFFFF</Color>
								<Color x:Key="DisabledThumbOuterBorderFillColor1">#FFF9FAFA</Color>
								<Color x:Key="DisabledThumbOuterBorderFillColor2">#FFEDF1F4</Color>
								<Color x:Key="DisabledThumbOuterBorderFillColor3">#FFE2E8EF</Color>
								<Color x:Key="DisabledThumbOuterBorderFillColor4">#FFC3C9CD</Color>
								<Color x:Key="DisabledThumbInnerBorderFillColor1">#CDFFFFFF</Color>
								<Color x:Key="DisabledThumbInnerBorderFillColor2">#45FFFFFF</Color>
							</Grid.Resources>
							<vsm:VisualStateManager.VisualStateGroups>
								<vsm:VisualStateGroup x:Name="CommonStates">
									<vsm:VisualStateGroup.Transitions>
										<vsm:VisualTransition GeneratedDuration="0:0:0.1" To="MouseOver"/>
										<vsm:VisualTransition GeneratedDuration="0:0:0.1" To="Pressed"/>
										<vsm:VisualTransition GeneratedDuration="0:0:0.1" To="Disabled"/>
									</vsm:VisualStateGroup.Transitions>
									<vsm:VisualState x:Name="Normal">
										<Storyboard/>
									</vsm:VisualState>
									<vsm:VisualState x:Name="MouseOver">
										<Storyboard>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbOuterBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource MouseOverThumbOuterBorderFillColor4}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource MouseOverThumbInnerBorderFillColor1}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource MouseOverThumbInnerBorderFillColor2}"/>
											</ColorAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Offset)">
												<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
											</DoubleAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Pressed">
										<Storyboard>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbOuterBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource PressedThumbOuterBorderFillColor1}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbOuterBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource PressedThumbOuterBorderFillColor4}"/>
											</ColorAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="DownStroke" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource PressedThumbInnerBorderFillColor1}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource PressedThumbInnerBorderFillColor2}"/>
											</ColorAnimationUsingKeyFrames>
											<DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
									<vsm:VisualState x:Name="Disabled">
										<Storyboard>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbOuterBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource DisabledThumbOuterBorderFillColor1}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbOuterBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource DisabledThumbOuterBorderFillColor4}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[0].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource DisabledThumbInnerBorderFillColor1}"/>
											</ColorAnimationUsingKeyFrames>
											<ColorAnimationUsingKeyFrames Storyboard.TargetName="ThumbInnerBorderFill" Storyboard.TargetProperty="(Shape.Fill).(GradientBrush.GradientStops)[1].(GradientStop.Color)">
												<SplineColorKeyFrame KeyTime="00:00:00" Value="{StaticResource DisabledThumbInnerBorderFillColor2}"/>
											</ColorAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
								</vsm:VisualStateGroup>
							</vsm:VisualStateManager.VisualStateGroups>
							<Rectangle Margin="0.75,0.75,0.75,0.75" x:Name="ThumbOuterBorderFill" IsHitTestVisible="true" RadiusX="2.5" RadiusY="2.5" Stretch="Fill" Stroke="#FFFFFFFF">
								<Rectangle.Fill>
									<LinearGradientBrush EndPoint="0.75,1" StartPoint="0.78721,0.0280347">
										<GradientStop Color="{StaticResource ThumbOuterBorderFillColor2}" Offset="0" x:Name="ThumbOuterBorderFillGradient1"/>
										<GradientStop Color="{StaticResource ThumbOuterBorderFillColor4}" Offset="1" x:Name="ThumbOuterBorderFillGradient4"/>
									</LinearGradientBrush>
								</Rectangle.Fill>
							</Rectangle>
							<Rectangle x:Name="ThumbOuterRoundBorder" RadiusX="2.5" RadiusY="2.5" Stretch="Fill" Stroke="{StaticResource ThumbOuterRoundBorderBrush}" StrokeThickness="1"/>
							<Rectangle Margin=".75" x:Name="ThumbInnerRoundBorder" RadiusX="2.5" RadiusY="2.5" Stretch="Fill" Stroke="{StaticResource ThumbInnerRoundBorderBrush}" StrokeThickness="1"/>
							<Path Margin="2.25,1.75,2.25,5.75" x:Name="ThumbInnerBorderFill" Stretch="Fill" Data="F1 M 11.653,2.38219L 2.00772,2.38219L 2.00772,8.95955C 3.42004,11.3623 5.069,12.7418 6.83035,12.7418C 8.59167,12.7418 10.2406,11.3623 11.653,8.95955L 11.653,2.38219 Z ">
								<Path.Fill>
									<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,1">
										<GradientStop Color="{StaticResource ThumbInnerBorderFillColor1}" Offset="0" x:Name="ThumbInnerBorderFillGradient1"/>
										<GradientStop Color="{StaticResource ThumbInnerBorderFillColor2}" Offset="1" x:Name="ThumbInnerBorderFillGradient2"/>
									</LinearGradientBrush>
								</Path.Fill>
							</Path>
							<Grid x:Name="DownStroke" Opacity="0">
								<Rectangle Margin="0.75,2,0.75,0.75" Opacity="0.05" RadiusX="2.5" RadiusY="2.5" Stroke="{StaticResource Background}" StrokeThickness="1"/>
								<Rectangle Margin="0.75,1.7,0.75,0.75" Opacity="0.05" RadiusX="2.5" RadiusY="2.5" Stroke="{StaticResource Background}" StrokeThickness="1"/>
								<Rectangle Margin="0.75,1.5,0.75,0.75" Opacity="0.05" RadiusX="2.5" RadiusY="2.5" Stroke="{StaticResource Background}" StrokeThickness="1"/>
								<Rectangle Margin="0.75,1.25,0.75,0.75" Opacity="0.05" RadiusX="2.5" RadiusY="2.5" Stroke="{StaticResource Background}" StrokeThickness="1"/>
								<Rectangle Margin="0.75,1,0.75,0.75" Opacity="0.05" RadiusX="2.5" RadiusY="2.5" Stroke="{StaticResource Background}" StrokeThickness="1"/>
								<Rectangle Margin=".75" Opacity="1" RadiusX="2.5" RadiusY="2.5" Stroke="{StaticResource Background}" StrokeThickness="1"/>
								<Rectangle Margin=".75" RadiusX="2.5" RadiusY="2.5" StrokeThickness="1">
									<Rectangle.Stroke>
										<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
											<GradientStop Color="#A5FFFFFF" Offset="0"/>
											<GradientStop Color="#FFFFFFFF" Offset="1"/>
											<GradientStop Color="#D5FFFFFF" Offset="0.371"/>
											<GradientStop Color="#DAFFFFFF" Offset="0.379"/>
										</LinearGradientBrush>
									</Rectangle.Stroke>
								</Rectangle>
								<Rectangle Margin="0.75,0.75,0.75,1" RadiusX="2.5" RadiusY="2.5" StrokeThickness="1">
									<Rectangle.Stroke>
										<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
											<GradientStop Color="#00FFFFFF" Offset="0"/>
											<GradientStop Color="#FFFFFFFF" Offset="1"/>
											<GradientStop Color="#00FFFFFF" Offset="0.371"/>
											<GradientStop Color="#00FFFFFF" Offset="0.393"/>
										</LinearGradientBrush>
									</Rectangle.Stroke>
								</Rectangle>
							</Grid>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		
		
		<Style x:Key="UT3SliderStyle" TargetType="Slider">
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="Slider">
						<Grid x:Name="Root">
							<Grid.Resources>
								<ControlTemplate x:Key="RepeatButtonTemplate">
									<Grid x:Name="Root" Opacity="0" Background="Transparent"/>
								</ControlTemplate>
							</Grid.Resources>
							<vsm:VisualStateManager.VisualStateGroups>
								<vsm:VisualStateGroup x:Name="CommonStates">
									<vsm:VisualStateGroup.Transitions>
										<vsm:VisualTransition GeneratedDuration="0"/>
									</vsm:VisualStateGroup.Transitions>
									<vsm:VisualState x:Name="Normal"/>
									<vsm:VisualState x:Name="MouseOver"/>
									<vsm:VisualState x:Name="Disabled">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="Root" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00" Value="0.5"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
								</vsm:VisualStateGroup>
								<vsm:VisualStateGroup x:Name="FocusStates">
									<vsm:VisualStateGroup.Transitions>
										<vsm:VisualTransition GeneratedDuration="0"/>
									</vsm:VisualStateGroup.Transitions>
									<vsm:VisualState x:Name="Unfocused"/>
									<vsm:VisualState x:Name="Focused">
										<Storyboard>
											<DoubleAnimationUsingKeyFrames Storyboard.TargetName="FocusVisual" Storyboard.TargetProperty="(UIElement.Opacity)">
												<SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
											</DoubleAnimationUsingKeyFrames>
										</Storyboard>
									</vsm:VisualState>
								</vsm:VisualStateGroup>
							</vsm:VisualStateManager.VisualStateGroups>
							<Grid x:Name="HorizontalTemplate">
								<Grid.ColumnDefinitions>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="Auto"/>
									<ColumnDefinition Width="*"/>
								</Grid.ColumnDefinitions>
								<RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="0"/>
								<Thumb Height="18" x:Name="HorizontalThumb" Style="{StaticResource UT3ThumbStyle}" Width="11" Grid.Column="1"/>
								<RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="2" Margin="0,0,-15,0"/>
								<Grid Height="15" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Center" Width="15" d:LayoutOverrides="GridBox" IsHitTestVisible="False">
									<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch" RadiusX="1.75" RadiusY="1.75" Fill="#FFFFFFFF" Margin="0,6.25,0,6.25"/>
								</Grid>
								<Grid Height="15" HorizontalAlignment="Right" Margin="0,0,-15,0" VerticalAlignment="Center" Width="15" Grid.Column="2" d:LayoutOverrides="GridBox" IsHitTestVisible="False">
									<Rectangle Height="2.5" HorizontalAlignment="Stretch" VerticalAlignment="Center" RadiusX="1.75" RadiusY="1.75" Fill="#FFFFFFFF"/>
									<Rectangle HorizontalAlignment="Center" VerticalAlignment="Stretch" RadiusX="1.75" RadiusY="1.75" Fill="#FFFFFFFF" Margin="0,0,0,0" Width="2.5"/>
								</Grid>
							</Grid>
							<Grid x:Name="VerticalTemplate" Visibility="Collapsed">
								<Grid.RowDefinitions>
									<RowDefinition Height="*"/>
									<RowDefinition Height="Auto"/>
									<RowDefinition Height="Auto"/>
								</Grid.RowDefinitions>
								<Rectangle Margin="0,5,0,5" Width="3" Grid.Row="0" Grid.RowSpan="3" Fill="#FFE6EFF7" Stroke="Black" StrokeThickness="0.5"/>
								<RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="2"/>
								<Thumb Height="11" x:Name="VerticalThumb" Width="18" Grid.Row="1"/>
								<RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="0"/>
							</Grid>
							<Rectangle x:Name="FocusVisual" IsHitTestVisible="false" Opacity="0" Stroke="#666666" StrokeDashArray=".2 5" StrokeDashCap="Round"/>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="UT3DataGridStyle" TargetType="local:DataGrid"
			xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
			xmlns:primitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows"
  			xmlns:localprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
			xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows">

			<Setter Property="RowBackground" Value="#FFF2F2F2"/>
			<Setter Property="AlternatingRowBackground" Value="#FFFFFFFF"/>
			<Setter Property="HorizontalGridLinesBrush" Value="#FFACACAC"/>
			<Setter Property="VerticalGridLinesBrush" Value="#FFACACAC"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="local:DataGrid">
						<Border BorderBrush="#FF000000" BorderThickness="0">
							<Border BorderBrush="#FFFFFFFF" BorderThickness="0">
								<Border BorderBrush="#FFA4A4A4" BorderThickness="0">

									<Grid x:Name="RootElement" Background="Transparent">
										<Grid.Resources>
											<ControlTemplate x:Key="TopLeftHeaderTemplate" TargetType="localprimitives:DataGridColumnHeader">
												<Grid x:Name="RootElement">
													<Grid.Background>
														<LinearGradientBrush StartPoint="0,0" EndPoint="0.28,0.71">
															<GradientStop Color="#FFF9FAFA" Offset="0"/>
															<GradientStop x:Name="StopColor2" Color="#FFEDF1F4" Offset="0.37259"/>
															<GradientStop x:Name="StopColor3" Color="#FFE2E8EF" Offset="0.372881"/>
															<GradientStop x:Name="StopColor4" Color="#FFC3C9CD" Offset="1"/>
														</LinearGradientBrush>
													</Grid.Background>

													<Grid.RowDefinitions>
														<RowDefinition Height="*" />
														<RowDefinition Height="*" />
														<RowDefinition Height="Auto" />
													</Grid.RowDefinitions>

													<Grid.ColumnDefinitions>
														<ColumnDefinition Width="*"/>
														<ColumnDefinition Width="Auto"/>
													</Grid.ColumnDefinitions>

													<Line Stretch="Fill" Grid.Column="1" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="#FFA4A4A4" />
													<Line Stretch="Fill" Grid.ColumnSpan="2" Grid.Row="2" X1="0" X2="1" Y1="0" Y2="0" StrokeThickness="1" Stroke="#FFA4A4A4" />
													<!--<Line Stretch="Fill" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}"/>-->
													<Rectangle Stretch="Fill" StrokeThickness="2" Stroke="#FFFFFFFF" Grid.RowSpan="2"/>
													<!-- TODO: Make this autosize
                                <Path Margin="1,1,1,0" Stretch="Fill" Data="F1 M 547.239,124.863L 430.795,124.863L 430.795,135.106C 447.845,138.848 467.753,140.997 489.017,140.997C 510.281,140.997 530.188,138.848 547.239,135.106L 547.239,124.863 Z ">
                                    <Path.Fill>
                                        <LinearGradientBrush StartPoint="0.5125,-0.0864589" EndPoint="0.5125,1.00202">
                                            <GradientStop Color="#B3FFFFFF" Offset="0"/>
                                            <GradientStop Color="#3CFFFFFF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Path.Fill>
                                </Path>
                                -->
												</Grid>
											</ControlTemplate>

											<ControlTemplate x:Key="TopRightHeaderTemplate" TargetType="localprimitives:DataGridColumnHeader">
												<Grid x:Name="RootElement">
													<Grid.Background>
														<LinearGradientBrush StartPoint="0,0" EndPoint="0.28,0.71">
															<GradientStop Color="#FFF9FAFA" Offset="0"/>
															<GradientStop x:Name="StopColor2" Color="#FFEDF1F4" Offset="0.37259"/>
															<GradientStop x:Name="StopColor3" Color="#FFE2E8EF" Offset="0.372881"/>
															<GradientStop x:Name="StopColor4" Color="#FFC3C9CD" Offset="1"/>
														</LinearGradientBrush>
													</Grid.Background>

													<Grid.RowDefinitions>
														<RowDefinition Height="*" />
														<RowDefinition Height="*" />
														<RowDefinition Height="Auto" />
													</Grid.RowDefinitions>

													<Grid.ColumnDefinitions>
														<ColumnDefinition Width="Auto"/>
														<ColumnDefinition Width="*"/>
													</Grid.ColumnDefinitions>

													<!--<Line Stretch="Fill" Grid.Column="1" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="#FFA4A4A4" />-->
													<Line Stretch="Fill" Grid.ColumnSpan="2" Grid.Row="2" X1="0" X2="1" Y1="0" Y2="0" StrokeThickness="1" Stroke="#FFA4A4A4" />
													<Line Stretch="Fill" Grid.RowSpan="2" X1="0" X2="0" Y1="0" Y2="1" StrokeThickness="1" Stroke="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}"/>
													<Rectangle Stretch="Fill" StrokeThickness="2" Stroke="#FFFFFFFF" Grid.Column="1" Grid.RowSpan="2"/>
													<!-- TODO: Make this autosize
                                <Path Grid.Column="1" Margin="1,1,1,0" Stretch="Fill" Data="F1 M 547.239,124.863L 430.795,124.863L 430.795,135.106C 447.845,138.848 467.753,140.997 489.017,140.997C 510.281,140.997 530.188,138.848 547.239,135.106L 547.239,124.863 Z ">
                                    <Path.Fill>
                                        <LinearGradientBrush StartPoint="0.5125,-0.0864589" EndPoint="0.5125,1.00202">
                                            <GradientStop Color="#B3FFFFFF" Offset="0"/>
                                            <GradientStop Color="#3CFFFFFF" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Path.Fill>
                                </Path>
                                -->
												</Grid>
											</ControlTemplate>
										</Grid.Resources>

										<Grid.RowDefinitions>
											<RowDefinition Height="Auto" />
											<RowDefinition Height="*" />
											<RowDefinition Height="Auto" />
										</Grid.RowDefinitions>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="Auto" />
											<ColumnDefinition Width="*" />
											<ColumnDefinition Width="Auto" />
										</Grid.ColumnDefinitions>

										<!-- Row 0 -->
										<localprimitives:DataGridColumnHeader x:Name="TopLeftCornerHeaderElement" Template="{StaticResource TopLeftHeaderTemplate}" />
										<localprimitives:DataGridColumnHeadersPresenter x:Name="ColumnHeadersPresenterElement" Grid.Column="1"/>
										<localprimitives:DataGridColumnHeader x:Name="TopRightCornerHeaderElement" Grid.Column="2" Template="{StaticResource TopRightHeaderTemplate}" />

										<!-- Row 1 -->
										<localprimitives:DataGridRowsPresenter x:Name="RowsPresenterElement" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" />
										<ScrollBar x:Name="VerticalScrollbarElement" Orientation="Vertical" Grid.Column="2" Grid.Row="1" Width="18" />

										<!-- Row 2 -->
										<Rectangle Fill="#FFE7E7E7" Grid.Row="2" Grid.ColumnSpan="2" />
										<ScrollBar x:Name="HorizontalScrollbarElement" Orientation="Horizontal" HorizontalAlignment="Stretch" Grid.Column="1" Grid.Row="2" Height="18" />
										<Rectangle Fill="#FFE7E7E7" Grid.Column="2" Grid.Row="2" />
									</Grid>
								</Border>
							</Border>
						</Border>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="UT3DataGridCellCenteredStyle" TargetType="local:DataGridCell"
			xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
			xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows">
			<Setter Property="HorizontalContentAlignment" Value="Center" />
			<Setter Property="Background" Value="Red" />
			<!--<Setter Property="TextAlignment" Value="Center" />-->
		</Style>

		<Style x:Key="UT3DataGridCellStyle" TargetType="local:DataGridCell"
			xmlns:local="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
  			xmlns:localprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
			xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows">

			<!-- TODO: Remove this workaround to force MouseLeftButtonDown event to be raised when root element is clicked. -->
			<Setter Property="Background" Value="Transparent" />
			<Setter Property="IsEnabled" Value="true" />
			<Setter Property="Foreground" Value="#FFffffff" />
			<Setter Property="HorizontalContentAlignment" Value="Stretch" />
			<Setter Property="VerticalContentAlignment" Value="Stretch" />
			<Setter Property="Cursor" Value="Arrow" />
			<!--<Setter Property="TextAlignment" Value="Left" />-->
			<!--<Setter Property="TextWrapping" Value="NoWrap" />-->
			<Setter Property="FontFamily" Value="Verdana" />
			<Setter Property="FontSize" Value="14" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="local:DataGridCell">
						<Grid x:Name="RootElement" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="{TemplateBinding Background}">
							<Grid.Resources>
								<Storyboard x:Key="Normal State">
									<DoubleAnimation Duration="0:0:0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity" To="0" />
								</Storyboard>
								<Storyboard x:Key="Normal Current State">
									<DoubleAnimation Duration="0:0:0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity" To="1" />
								</Storyboard>
							</Grid.Resources>

							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>

							<ContentPresenter
                        Content="{TemplateBinding Content}"
                        ContentTemplate="{TemplateBinding ContentTemplate}"
                        Cursor="{TemplateBinding Cursor}"
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

							<!-- TODO Refactor this if SL ever gets a FocusVisualStyle on FrameworkElement -->
							<Rectangle x:Name="FocusVisualElement" Stroke="#00000000" StrokeDashArray="0"
                        HorizontalAlignment="Stretch" VerticalAlignment="Stretch" StrokeDashCap="Round" 
                        IsHitTestVisible="false" Opacity="0" />

							<Rectangle x:Name="RightGridlineElement" Grid.Column="1" VerticalAlignment="Stretch" Width="1" />
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>

		<Style x:Key="UT3DataGridHeaderStyle" TargetType="localprimitives:DataGridColumnHeader"
  			xmlns:localprimitives="clr-namespace:System.Windows.Controls.Primitives;assembly=System.Windows.Controls.Data"
			xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows">

			<Setter Property="SeparatorBrush" Value="#FFA4A4A4"/>
			<Setter Property="SeparatorVisibility" Value="Visible"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="localprimitives:DataGridColumnHeader">
						<Grid x:Name="RootElement">

							<Grid.Resources>
								<Storyboard x:Key="Normal State">
									<ColorAnimation Storyboard.TargetName="StopColor2" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFEDF1F4"/>
									<ColorAnimation Storyboard.TargetName="StopColor3" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFE2E8EF"/>
									<ColorAnimation Storyboard.TargetName="StopColor4" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFC3C9CD"/>
								</Storyboard>
								<Storyboard x:Key="MouseOver State">
									<ColorAnimation Storyboard.TargetName="StopColor2" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFE6EFF7"/>
									<ColorAnimation Storyboard.TargetName="StopColor3" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FFD3E4F5"/>
									<ColorAnimation Storyboard.TargetName="StopColor4" Storyboard.TargetProperty="(Color)" Duration="00:00:0.3" To="#FF87A5BA"/>
								</Storyboard>
								<Storyboard x:Key="Unsorted State">
									<DoubleAnimation Storyboard.TargetName="SortIconElement" Storyboard.TargetProperty="Opacity" Duration="00:00:0.3" To="0.0"/>
									<DoubleAnimation Storyboard.TargetName="SortIconTransform" Storyboard.TargetProperty="ScaleY" BeginTime="00:00:0.3" Duration="00:00:0.0" To="1"/>
								</Storyboard>
								<Storyboard x:Key="SortedAscending State">
									<DoubleAnimation Storyboard.TargetName="SortIconElement" Storyboard.TargetProperty="Opacity" Duration="00:00:0.3" To="1.0"/>
									<DoubleAnimation Storyboard.TargetName="SortIconTransform" Storyboard.TargetProperty="ScaleY" Duration="00:00:0.3" To="-1"/>
								</Storyboard>
								<Storyboard x:Key="SortedDescending State">
									<DoubleAnimation Storyboard.TargetName="SortIconElement" Storyboard.TargetProperty="Opacity" Duration="00:00:0.3" To="1.0"/>
									<DoubleAnimation Storyboard.TargetName="SortIconTransform" Storyboard.TargetProperty="ScaleY" Duration="00:00:0.3" To="1"/>
								</Storyboard>
							</Grid.Resources>

							<Grid.Background>
								<LinearGradientBrush StartPoint="0.276463,-0.00385181" EndPoint="0.276463,0.71">
									<GradientStop Color="#FFF9FAFA" Offset="0"/>
									<GradientStop x:Name="StopColor2" Color="#FFEDF1F4" Offset="0.37259"/>
									<GradientStop x:Name="StopColor3" Color="#FFE2E8EF" Offset="0.372881"/>
									<GradientStop x:Name="StopColor4" Color="#FFC3C9CD" Offset="1"/>
								</LinearGradientBrush>
							</Grid.Background>

							<Grid.RowDefinitions>
								<RowDefinition Height="*" />
								<RowDefinition Height="*" />
								<RowDefinition Height="Auto" />
							</Grid.RowDefinitions>
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="Auto" />
								<ColumnDefinition Width="Auto" />
							</Grid.ColumnDefinitions>

							<Rectangle Stretch="Fill" StrokeThickness="2" Stroke="#FFFFFFFF" Grid.ColumnSpan="2" Grid.RowSpan="2"/>
							<Rectangle Grid.Row="2" Grid.ColumnSpan="3" Height="1" HorizontalAlignment="Stretch" Fill="#FFA4A4A4" />
							<Rectangle Grid.RowSpan="2" Grid.Column="2" Width="1" VerticalAlignment="Stretch" Fill="{TemplateBinding SeparatorBrush}" Visibility="{TemplateBinding SeparatorVisibility}" /> 
							<!-- TODO: Put this back when SL gets ViewBox; Currently this path kills autosizing
                    <Path Margin="1,1,1,0" Stretch="Fill" Grid.ColumnSpan="2" Data="F1 M 547.239,124.863L 430.795,124.863L 430.795,135.106C 447.845,138.848 467.753,140.997 489.017,140.997C 510.281,140.997 530.188,138.848 547.239,135.106L 547.239,124.863 Z ">
                        <Path.Fill>
                            <LinearGradientBrush StartPoint="0.5125,-0.0864589" EndPoint="0.5125,1.00202">
                                <GradientStop Color="#B3FFFFFF" Offset="0"/>
                                <GradientStop Color="#3CFFFFFF" Offset="1"/>
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    -->

							<ContentPresenter Margin="3,0,-10,0" Content="{TemplateBinding Content}" VerticalAlignment="Center"  />
							<Path x:Name="SortIconElement" Margin="3,0,3,0" Opacity="0" Grid.Column="1" Stretch="Uniform" Width="8" Data="F1 M -5.215,0.0L 5.215,0.0L 0,6.099L -5.215,0.0 Z " Fill="#FF313131">
								<Path.RenderTransform>
									<ScaleTransform x:Name="SortIconTransform" CenterX="4" CenterY="2.5" ScaleX="1" ScaleY="1" />
								</Path.RenderTransform>
							</Path>
						</Grid>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
    	<Style x:Key="UT3DataGridStyle2" TargetType="data:DataGrid">
    		<Setter Property="RowBackground" Value="#AAEAEFF4"/>
    		<Setter Property="AlternatingRowBackground" Value="#00FFFFFF"/>
    		<Setter Property="Background" Value="#FFFFFFFF"/>
    		<Setter Property="HeadersVisibility" Value="Column"/>
    		<Setter Property="HorizontalScrollBarVisibility" Value="Auto"/>
    		<Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
    		<Setter Property="SelectionMode" Value="Extended"/>
    		<Setter Property="CanUserReorderColumns" Value="True"/>
    		<Setter Property="CanUserResizeColumns" Value="True"/>
    		<Setter Property="CanUserSortColumns" Value="True"/>
    		<Setter Property="AutoGenerateColumns" Value="True"/>
    		<Setter Property="RowDetailsVisibilityMode" Value="VisibleWhenSelected"/>
    		<Setter Property="BorderBrush" Value="{x:Null}"/>
    		<Setter Property="BorderThickness" Value="1"/>
    		<Setter Property="DragIndicatorStyle">
    			<Setter.Value>
    				<Style TargetType="ContentControl">
    					<Setter Property="FontSize" Value="10.5"/>
    					<Setter Property="FontWeight" Value="Bold"/>
    					<Setter Property="Foreground" Value="#7FFFFFFF"/>
    					<Setter Property="Template">
    						<Setter.Value>
    							<ControlTemplate TargetType="ContentControl">
    								<Grid>
    									<Grid.RowDefinitions>
    										<RowDefinition Height="*"/>
    										<RowDefinition Height="*"/>
    										<RowDefinition Height="Auto"/>
    									</Grid.RowDefinitions>
    									<Grid.ColumnDefinitions>
    										<ColumnDefinition Width="Auto"/>
    										<ColumnDefinition Width="*"/>
    										<ColumnDefinition Width="Auto"/>
    									</Grid.ColumnDefinitions>
    									<Rectangle x:Name="BackgroundRectangle" Grid.ColumnSpan="2" Grid.RowSpan="2" Fill="#66808080" Stretch="Fill"/>
    									<Rectangle x:Name="BackgroundGradient" Opacity="0" Grid.ColumnSpan="2" Grid.RowSpan="2" Stretch="Fill">
    										<Rectangle.Fill>
    											<LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
    												<GradientStop Color="#FFFFFFFF" Offset="0.015"/>
    												<GradientStop Color="#F9FFFFFF" Offset="0.375"/>
    												<GradientStop Color="#E5FFFFFF" Offset="0.6"/>
    												<GradientStop Color="#C6FFFFFF" Offset="1"/>
    											</LinearGradientBrush>
    										</Rectangle.Fill>
    									</Rectangle>
    									<ContentPresenter Margin="4,4,5,4" VerticalAlignment="Center"/>
    									<Rectangle VerticalAlignment="Stretch" Width="1" Visibility="Visible" Grid.Column="2" Grid.RowSpan="2" Fill="#FFAAAAAA"/>
    									<Path HorizontalAlignment="Left" x:Name="SortIcon" VerticalAlignment="Center" Width="8" Opacity="0" RenderTransformOrigin=".5,.5" Grid.Column="1" Fill="#7FFFFFFF" Stretch="Uniform" Data="F1 M -5.215,0.0L 5.215,0.0L 0,6.099L -5.215,0.0 Z ">
    										<Path.RenderTransform>
    											<TransformGroup>
    												<ScaleTransform ScaleX=".9" ScaleY=".9"/>
    												<RotateTransform x:Name="SortIconTransform"/>
    											</TransformGroup>
    										</Path.RenderTransform>
    									</Path>
    								</Grid>
    							</ControlTemplate>
    						</Setter.Value>
    					</Setter>
    				</Style>
    			</Setter.Value>
    		</Setter>
    		<Setter Property="DropLocationIndicatorStyle">
    			<Setter.Value>
    				<Style TargetType="Control">
    					<Setter Property="Background" Value="#FF3F4346"/>
    					<Setter Property="Width" Value="2"/>
    					<Setter Property="Template">
    						<Setter.Value>
    							<ControlTemplate TargetType="Control">
    								<Rectangle Height="{TemplateBinding Height}" Width="{TemplateBinding Width}" Fill="{TemplateBinding Background}"/>
    							</ControlTemplate>
    						</Setter.Value>
    					</Setter>
    				</Style>
    			</Setter.Value>
    		</Setter>
    		<Setter Property="GridLinesVisibility" Value="Vertical"/>
    		<Setter Property="HorizontalGridLinesBrush" Value="#FFC9CACA"/>
    		<Setter Property="IsTabStop" Value="True"/>
    		<Setter Property="VerticalGridLinesBrush" Value="#FFC9CACA"/>
    		<Setter Property="Template">
    			<Setter.Value>
    				<ControlTemplate TargetType="data:DataGrid">
    					<Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="2">
    						<Grid x:Name="Root">
    							<Grid.Resources>
    								<ControlTemplate x:Key="TopLeftHeaderTemplate" TargetType="System_Windows_Controls_Primitives:DataGridColumnHeader">
    									<Grid x:Name="Root">
    										<Grid.RowDefinitions>
    											<RowDefinition Height="*"/>
    											<RowDefinition Height="*"/>
    											<RowDefinition Height="Auto"/>
    										</Grid.RowDefinitions>
    										<Border Grid.RowSpan="2" Background="#FF1F3B53" BorderBrush="#FFC9CACA" BorderThickness="0,0,1,0">
    											<Rectangle Stretch="Fill" StrokeThickness="1">
    												<Rectangle.Fill>
    													<LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
    														<GradientStop Color="#FFFFFFFF" Offset="0.015"/>
    														<GradientStop Color="#F9FFFFFF" Offset="0.375"/>
    														<GradientStop Color="#E5FFFFFF" Offset="0.6"/>
    														<GradientStop Color="#C6FFFFFF" Offset="1"/>
    													</LinearGradientBrush>
    												</Rectangle.Fill>
    											</Rectangle>
    										</Border>
    										<Rectangle Height="1" VerticalAlignment="Bottom" Width="Auto" Grid.RowSpan="2" Fill="#FFDBDCDC" StrokeThickness="1"/>
    									</Grid>
    								</ControlTemplate>
    								<ControlTemplate x:Key="TopRightHeaderTemplate" TargetType="System_Windows_Controls_Primitives:DataGridColumnHeader">
    									<Grid x:Name="RootElement">
    										<Grid.RowDefinitions>
    											<RowDefinition Height="*"/>
    											<RowDefinition Height="*"/>
    											<RowDefinition Height="Auto"/>
    										</Grid.RowDefinitions>
    										<Border Grid.RowSpan="2" Background="#FF1F3B53" BorderBrush="#FFC9CACA" BorderThickness="1,0,0,0">
    											<Rectangle Stretch="Fill">
    												<Rectangle.Fill>
    													<LinearGradientBrush EndPoint=".7,1" StartPoint=".7,0">
    														<GradientStop Color="#FFFFFFFF" Offset="0.015"/>
    														<GradientStop Color="#F9FFFFFF" Offset="0.375"/>
    														<GradientStop Color="#E5FFFFFF" Offset="0.6"/>
    														<GradientStop Color="#C6FFFFFF" Offset="1"/>
    													</LinearGradientBrush>
    												</Rectangle.Fill>
    											</Rectangle>
    										</Border>
    									</Grid>
    								</ControlTemplate>
    							</Grid.Resources>
    							<Grid.ColumnDefinitions>
    								<ColumnDefinition Width="Auto"/>
    								<ColumnDefinition Width="*"/>
    								<ColumnDefinition Width="Auto"/>
    							</Grid.ColumnDefinitions>
    							<Grid.RowDefinitions>
    								<RowDefinition Height="Auto"/>
    								<RowDefinition Height="*"/>
    								<RowDefinition Height="Auto"/>
    							</Grid.RowDefinitions>
    							<System_Windows_Controls_Primitives:DataGridColumnHeader x:Name="TopLeftCornerHeader" Width="22" Template="{StaticResource TopLeftHeaderTemplate}"/>
    							<System_Windows_Controls_Primitives:DataGridColumnHeadersPresenter x:Name="ColumnHeadersPresenter" Grid.Column="1"/>
    							<System_Windows_Controls_Primitives:DataGridColumnHeader x:Name="TopRightCornerHeader" Template="{StaticResource TopRightHeaderTemplate}" Grid.Column="2"/>
    							<Rectangle Height="1" x:Name="ColumnHeadersAndRowsSeparator" VerticalAlignment="Bottom" Width="Auto" Grid.ColumnSpan="3" Fill="#FFDBDCDC" StrokeThickness="1"/>
    							<System_Windows_Controls_Primitives:DataGridRowsPresenter x:Name="RowsPresenter" Grid.ColumnSpan="2" Grid.Row="1"/>
    							<Rectangle x:Name="BottomRightCorner" Grid.Column="2" Grid.Row="2" Fill="#FFE9EEF4"/>
    							<Rectangle x:Name="BottomLeftCorner" Grid.ColumnSpan="2" Grid.Row="2" Fill="#FFE9EEF4"/>
    							<ScrollBar Margin="0,-1,-1,-1" x:Name="VerticalScrollbar" Width="18" Grid.Column="2" Grid.Row="1" Orientation="Vertical"/>
    							<Grid Grid.Column="1" Grid.Row="2">
    								<Grid.ColumnDefinitions>
    									<ColumnDefinition Width="Auto"/>
    									<ColumnDefinition Width="*"/>
    								</Grid.ColumnDefinitions>
    								<Rectangle x:Name="FrozenColumnScrollBarSpacer"/>
    								<ScrollBar Height="18" Margin="-1,0,-1,-1" x:Name="HorizontalScrollbar" Grid.Column="1" Orientation="Horizontal"/>
    							</Grid>
    						</Grid>
    					</Border>
    				</ControlTemplate>
    			</Setter.Value>
    		</Setter>
    	</Style>
	</Application.Resources>
</Application>
